#!/usr/bin/python
# vim:fileencoding=utf8

import word

def get_article_a(**form):
    plurum = form.get('plurum', False)
    vowel  = form.get('vowel',False)
    if plurum:
        return ''
    elif vowel:
        return 'an'
    else:
        return 'a'
    
    
def get_article(**form):
    definite = form.get('definite', None)
    if definite is None:
        return ""
    elif definite:
        return 'the'
    else:
        return ArticleA.to_string(**form)


def recognize_article(string):
    if string == 'a' or string == 'an':
        return [(string,{'plurum':False, 'definite':False})]
    elif string == 'the':
        return [(string,{'definite':True})]
    else:
        return []


Article = word.Word('')
Article.to_string = get_article
Article.base_form = recognize_article
Article.is_stop_word = True


ArticleA = word.Word('')
ArticleA.__call__ = lambda self: self
ArticleA.to_string = get_article_a
ArticleA.stop_word = True

ArticleThe = word.Word('')
ArticleThe.__call__ = lambda self: self
ArticleThe.to_string = lambda : 'the'
ArticleThe.stop_word = True